package com.example.demo.demoEntity;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "t_user_role", schema = "tc40", catalog = "")
public class TUserRoleEntity {
    private int id;
    private Integer userId;
    private Integer roleId;

    @Id
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "user_id", nullable = true)
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "role_id", nullable = true)
    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TUserRoleEntity that = (TUserRoleEntity) o;
        return id == that.id && Objects.equals(userId, that.userId) && Objects.equals(roleId, that.roleId);
    }

    public TUserRoleEntity(int id, Integer userId, Integer roleId) {
        this.id = id;
        this.userId = userId;
        this.roleId = roleId;
    }

    public TUserRoleEntity() {
    }

    @Override
    public String toString() {
        return "TUserRoleEntity{" +
                "id=" + id +
                ", userId=" + userId +
                ", roleId=" + roleId +
                '}';
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, roleId);
    }
}
